//
//  UILabel+Extension.swift
//  GZWeibo
//
//  Created by Apple on 15/9/21.
//  Copyright © 2015年 itcast. All rights reserved.
//

import UIKit

extension UILabel {
    
    //便利构造函数
    convenience init(title: String, color: UIColor, fontSize: CGFloat, layoutWidth:CGFloat = 0 ) {
        self.init()
        
        text = title
        textColor = color
        font = UIFont.systemFontOfSize(fontSize)
        numberOfLines = 0
        if layoutWidth > 0 {
            // 指定多行文本的换行宽度
            preferredMaxLayoutWidth = layoutWidth
            textAlignment = .Left
        }else{
            textAlignment = NSTextAlignment.Center
 
        }
        
        
        sizeToFit()
    }
}
